#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;
int a[N];
set<pii> sth, stv;
bool check(int x, int y, int d) {
  // check h
  rep(i, 0, d - 1) {
    if (!sth.count(pii(x, y + i))) return false;
    if (!sth.count(pii(x + d, y + i))) return false;
  }
  // check v
  rep(i, 0, d - 1) {
    if (!stv.count(pii(x + i, y))) return false;
    if (!stv.count(pii(x + i, y + d))) return false;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int id = 0;
  while (cin >> n) {
    ++id;
    if (id > 1) {
      cout << endl;
      cout << "**********************************" << endl;
      cout << endl;
    }
    cout << "Problem #" << id << endl;
    cout << endl;

    sth.clear(), stv.clear();
    cin >> m;
    rep(i, 1, m) {
      char c;
      int x, y;
      cin >> c >> x >> y;
      if (c == 'H')
        sth.insert(pii(x, y));
      else
        stv.insert(pii(y, x));
    }
    int tot = 0;
    rep(d, 1, n - 1) {
      int cnt = 0;
      rep(i, 1, n - d) rep(j, 1, n - d) {
        if (check(i, j, d)) cnt++;
      }
      if (cnt) cout << cnt << " square (s) of size " << d << endl;
      tot += cnt;
    }
    if (!tot) cout << "No completed squares can be found." << endl;
  }
  return 0;
}